home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
ada
/
c01oop.zip
/
CPPWKBK
/
CPPV2-7.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1992-08-25
|
803b
|
41 lines
#define HEADER "C++ Problem 2.7 by Rick Conn using Borland C++"
#include <stdio.h>
class person {
char *name;
public:
person (char *my_name); // create a person with
// a given name
void print_me(void); // print the name of the person
// and his address using this
};
person::person (char *my_name)
{
name = my_name;
}
void person::print_me(void)
{
printf("The name is %s\n", name);
printf("The address is %p\n", this);
}
void main(void)
{
printf("%s\n", HEADER);
person ck ("Clark Kent");
person s ("Superman");
person bw ("Bruce Wayne");
person b ("Batman");
person bs ("Bjarne Stroustrop");
ck.print_me();
s.print_me();
bw.print_me();
b.print_me();
bs.print_me();
}